package com.tyd.cams.Adapter;

import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;
import android.widget.Toast;

import com.tyd.cams.R;
import com.tyd.cams.TzggActivity;
import com.tyd.cams.entity.KaoQinJilubean;
import com.tyd.cams.entity.SkTzgg;

import java.util.List;

import static com.xuexiang.xui.XUI.getContext;

/**
 * @author: TYD
 * @作者: 唐YaDong
 * @date: 2021/3/7 4:51
 * @description：KaoqinListAdapter
 * @描述：KaoqinListAdapter 考勤记录ListView适配器
 * @版本：1.0
 */

public class KaoqinListAdapter extends BaseAdapter {
    private List<KaoQinJilubean> list;
    private LayoutInflater layoutInflater;

    public KaoqinListAdapter(Context context, List<KaoQinJilubean> list) {
        this.layoutInflater = LayoutInflater.from(context);
        this.list = list;
    }

    @Override
    public int getCount() {
        return list.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder viewHolder;
        if (convertView == null) {
            convertView = layoutInflater.inflate(R.layout.kaoqin_item, null);
            viewHolder = new ViewHolder(convertView);
            convertView.setTag(viewHolder);
        } else {
            viewHolder = (ViewHolder) convertView.getTag();
        }
        KaoQinJilubean kaoQinJilubean = list.get(position);
        viewHolder.Kdd.setText(kaoQinJilubean.getKdd());
        viewHolder.Kname.setText(  kaoQinJilubean.getKname());
        viewHolder.Ktime.setText(  kaoQinJilubean.getKtime());
        return convertView;
    }
    class ViewHolder {
        TextView Kdd;
        TextView Kname;
        TextView Ktime;

        public ViewHolder(View view) {
            Kdd = view.findViewById(R.id.Kdd);
            Kname = view.findViewById(R.id.Kname);
            Ktime = view.findViewById(R.id.Ktime);
        }
    }
}
